from Devices.Chiot.BsDevs.ComDev.ComDev import ComDev

class SwitchDevice(ComDev):
    class SwitchFullStatus:
        def __init__(self):
            self.switch1Status = 0
            self.switch2Status = 0
            self.switch3Status = 0
            self.switch4Status = 0
            self.memSwitchStatus = 0
            self.backlightStatus = 0

            self.timers = []
            self.delay = SwitchDevice.Delay()
        
    class Timer(ComDev.Timer):
        def __init__(self, id = "", enable = False, start = "", end = "", services = [], week = 0):
            super().__init__(id, enable, start, end, services, week)

        def GetServiceString(self):
            serviceString = ""
            for srv in self.services:
                if srv.serviceId == "switch1":
                    serviceString += "开关1 "
                elif srv.serviceId == "switch2":
                    serviceString += "开关2 "
                elif srv.serviceId == "switch3":
                    serviceString += "开关3 "
                elif srv.serviceId == "switch4":
                    serviceString += "开关4 "
                else: #srv.serviceId == "switch4"
                    serviceString += "未知服务"+srv.serviceId
                serviceString += ("打开;  " if srv.paraValue else "关闭;  ")
            return serviceString[:-3]
